<!DOCTYPE html>
<html>

	<head>
		<title>OpenAuth.net官方网站 - 最好用的.net权限工作流框架|.net core快速开发框架|.net core权限管理|.net core工作流</title>
  		<meta name="Keywords" content="openauth.net,.net开源工作流,.NET开源权限管理">
  		<meta name="Description" content="最好用的.net开源工作流框架,最好用的.NET开源权限管理框架">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1.0">
		<link rel="stylesheet" href="../../css/element-ui.css">
		<link href="../../font/css/font-awesome.min.css" rel="stylesheet">
		<link rel="stylesheet" href="../../css/common.css">
		<link rel="stylesheet" href="../../css/question/detail.css">
		<style>
			.editor-custom-btn-container {
				top: -3px;
			}
		</style>
	</head>

	<body>
		<div id="app">
			<el-container>
				<el-header class="box-flex align-center">
					<app-header :current="current"></app-header>
				</el-header>
				<el-main class="bg-white">
					<div class="container p-t-m box-flex">
						<div class="left-body flex-1 flex-wrap">
							<div class="article">
								
								<el-form label-width="100px" :model="question">
										<el-form-item label="标题" prop="title">
											<el-input class="w-100-00" size="small" v-model="question.title" clearable></el-input>
										</el-form-item>
										<el-form-item label="描述">
											<div class="p-r-sm">
												<tinymce :height="400" v-model="question.content"></tinymce>
											</div>
										</el-form-item>
										<el-form-item label="悬赏金额">
											<el-slider v-model="question.experience" show-input></el-slider>
										</el-form-item>

										<el-form-item>
											<el-button type="primary" :loading="loading" @click="save">立即提交</el-button>
										</el-form-item>
									</el-form>
							</div>
							
						</div>

						<div class="right-body">
							<el-card class="left-body flex-1 card-small" shadow="never">
								<div slot="header" class="clearfix box-flex">
									最近热帖
								</div>
								<div class="p-m news">
									<template v-for="(hot,index) in hots">
										<div class="new ellipsis box-flex align-center" @click="linkDetail(hot)" :key="index+1">
											<div class="num" v-if="index>=9">{{index+1}}.</div>
											<div class="num" v-else>0{{index+1}}.</div>
											<div class="title ellipsis">
												{{ hot.title }}
											</div>
											<div class="scan">
												<i class="fa fa-fw fa-eye">{{ hot.hits }}</i>
											</div>
										</div>
									</template>

								</div>
							</el-card>

							<el-card class="left-body flex-1 card-small" shadow="never">
								<div slot="header" class="clearfix box-flex">
									友情链接
								</div>
								<div class="box-flex flex-wrap p-m">
										<div class="link">
												<a href="https://panjiachen.github.io/vue-element-admin-site/zh/" target="_blank">vue-element-admin</a>
										</div>
										<div class="link">
											<a href="https://cn.vuejs.org/" target="_blank">VUE</a>
										</div>
										<div class="link">
											<a href="https://dotnetchina.gitee.io/furion/" target="_blank">Furion</a>
										</div>
										<div class="link">
											<a href="http://element.eleme.io/#/zh-CN" target="_blank">ELement-UI</a>
										</div>
										<div class="link">
											<a href="https://fly.layui.com/" target="_blank">LayUI</a>
										</div>
								</div>
							</el-card>
						</div>
					</div>
				</el-main>
				<el-footer height="100px">
					<app-footer></app-footer>
				</el-footer>
			</el-container>
		</div>

	</body>
	<!-- import Vue before Element -->
	<script src="../../js/vue.js"></script>

	<!-- import JavaScript -->
	<script src="../../js/element-ui.js"></script>
	<script src="../../js/axios.js"></script>
	<script src="../../js/header.js"></script>
	<script src="../../js/footer.js?v=2"></script>
	<script src="../../tinymce4.7.5/tinymce.min.js"></script>
	<script src="../../js/common.js"></script>
	<script type="text/template" id="tiny">
		<div :class="{fullscreen:fullscreen}" class="tinymce-container editor-container">
			<textarea :id="tinymceId" class="tinymce-textarea" />
			<div class="editor-custom-btn-container">
				<editorImage color="#1890ff" class="editor-upload-btn" @successCBK="imageSuccessCBK" />
			</div>
		</div>
	</script>
	<script src="../../js/TinyMce/eidtorImage.js"></script>
	<script src="../../js/TinyMce/index.js"></script>
	<script>
		new Vue({
			components: {
				'tinymce': tinyMce
			},
			data() {
				return {
					current: "qa",
					loading: false,
					user: {},
					current: "qa",
					question: {},
					questions: [],
					hots: [],
				}
			},
			created() {
				var id = GetQueryString('id')
				var isLogin = sessionStorage.isLogin
				if(isLogin === 'true') {
					var user = sessionStorage.user
					user = JSON.parse(user);
					this.user = user
				}
				service({
					url: '/questions/getone?id='+id,
					method: 'get',
				}).then((res) => {
					this.question = res.data;
				})
				this.getHot()
			},
			methods: {
				getHot() {
					service({
						url: '/questions/gethot',
						method: 'get',
					}).then((res) => {

						if(res.data.total >= 10) {
							for(var i = 0; i < 10; i++) {
								this.hots.push(res.data.objects[i])
							}
						} else {
							this.hots = res.data.objects
						}
					})
				},
				linkDetail(e){
					window.location.href="detail.html?id="+e.id
				},
				linkUser(id){
					window.location.href="../user/index.html?id="+id
				},
				save() {
					this.loading = true
					if(this.question.title == '') {
						this.$notify.error({
							message: '请填写标题'
						})
						this.loading = false
						return
					}
					if(this.question.content == '') {
						this.$notify.error({
							message: '请填写描述'
						})
						this.loading = false
						return
					}
					this.question.userid = this.user.id
					service({
						url: '/questions/edit',
						method: 'post',
						data:this.question
					}).then((res) => {
						if(res.code !== 200) {
							this.$notify.error({
								title: '错误',
								message: res.message
							})
							this.loading = false
							return
						}
						this.$notify.success({
							title: '提交成功',
						})
						setTimeout(function() {
							history.go(-1)
						}, 1000)
					}).catch(()=>{
						this.loading = false
					})
				}
			}
		}).$mount('#app')
	</script>

</html>